/*
 * @FilePath: /flutter_cart/lib/provide/details_info.dart
 * @Author: Yongchao Wang
 * @Date: 2020-12-10 20:37:32
 * @LastEditors: Yongchao Wang
 * @LastEditTime: 2020-12-10 21:25:30
 */
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cart/model/details_model.dart';
import 'package:flutter_cart/service/service_method.dart';

import 'dart:convert';

class DetailsInfoProvide with ChangeNotifier, DiagnosticableTreeMixin {
  DetailsModel _goodInfo;
  //从后台获取数据
  getGoodInfo(String id) {
    var formData = {'goodId': id};
    request('getGoodDetailById', 'post', formData).then((val) {
      var responseData = jsonDecode(val.toString());
      _goodInfo = DetailsModel.fromJson(responseData);
    });
    notifyListeners();
  }

  DetailsModel get goodInfo => _goodInfo;
  @override
  void debugFillProperties(DiagnosticPropertiesBuilder properties) {
    super.debugFillProperties(properties);
  }
}
